package com.cloudbroker.bcs.csvc.credits.api.t2;

import com.cloudbroker.bcs.csvc.credits.api.service.CreditsBizService;
import com.cloudbroker.bcs.csvc.credits.api.service.TkOpenBizService;
import com.cloudbroker.bcs.csvc.credits.api.t2service.CreditsT2BizService;
import com.cloudbroker.bcs.csvc.credits.api.vo.back.CreditsBackVO;
import com.cloudbroker.bcs.csvc.credits.api.vo.back.CreditsVO;
import com.cloudbroker.bcs.csvc.credits.api.vo.back.ResultVO;
import com.cloudbroker.bcs.csvc.credits.api.vo.request.*;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Created by lili19289 on 2016/10/26.
 */
@Service
public class CreditsT2 implements CreditsT2BizService {

    @Resource
    private CreditsBizService creditsBizService;

    @Resource
    private TkOpenBizService tkOpenBizService;


    public CreditsVO functionAddCredits(CreditsOperForm form){
        if("20033".equals(form.getCompany_id())){
            try{
                creditsBizService.functionAddCredits(form);
            }catch (Exception e){
                e.printStackTrace();
            }
            return tkOpenBizService.functionAddCredits(form);
        }
        return creditsBizService.functionAddCredits(form);
    }

    public CreditsVO functionConsumeCredits(CreditsOperForm form){
        if("20033".equals(form.getCompany_id())){
            try{
                creditsBizService.functionConsumeCredits(form);
            }catch (Exception e){
                e.printStackTrace();
            }
            return tkOpenBizService.functionConsumeCredits(form);
        }
        return creditsBizService.functionConsumeCredits(form);
    }


    public CreditsVO functionGetCreditsByUser(UserCreditsForm form){
        if("20033".equals(form.getCompany_id())){
            try{
                creditsBizService.functionGetCreditsByUser(form);
            }catch (Exception e){
                e.printStackTrace();
            }
            return tkOpenBizService.functionGetCreditsByUser(form);
        }
        return creditsBizService.functionGetCreditsByUser(form);
    }

    public ResultVO functionQueryCredits(QueryCreditsForm form){

        return creditsBizService.functionQueryCredits(form);
    }

    public ResultVO functionQueryCreditsLog(QueryCreditslogForm form){
        return creditsBizService.functionQueryCreditsLog(form);
    }

//    public HSBCPSBackVO func_add_credits_rule(CreditsRuleAddForm form){
//        return creditsBizService.func_add_credits_rule(form);
//    }
//
//    public CreditsRuleBackVO func_findByBusinessType(CreditsRuleForm form){
//        return creditsBizService.func_findByBusinessType(form);
//    }
}
